package com.lyx.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * --- Be Humble and Hungry ---
 *
 * @author McMeloxD
 * @date 2024/8/12
 * @desc
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R<T> {
    private int code;
    private String msg;
    private T data;

    /**
     * 成功
     */
    public static <T> R<T> ok(T data) {
        return new R<>(200,"成功",data);
    }

    /**
     * 失败
     */
    public static <T> R<T> fail(T data) {
        return new R<>(400,"操作失败",data);
    }
}
